import {
  getRoleList
} from '../../../util/axios'

const state = {

  roleList: []
}


const getters = {
  getRoleList(state) {
    return state.roleList
  }
}
const mutations = {


  REQ_ROLELIST(state, payload) {

    state.roleList = payload
  }
}



const actions = {
  //反复的触发这一个行动让它实现 ，实时更新的效果
  getRoleListAction({
    commit
  }) {
    //    console.log('觉色行动');

    getRoleList()
      .then(res => {
        if (res.data.code == 200) {
          //   console.log(res);
          commit('REQ_ROLELIST', res.data.list)


        }
      })


  }
}


export default {

  state,
  actions,
  mutations,
  getters,
  namespaced: true

}
